﻿var __L_XmlHttp = false;
try{__L_XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");}catch (e){try{__L_XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}catch (e){__L_XmlHttp = false;}}  
if(!__L_XmlHttp && typeof XMLHttpRequest != 'undefined') {try {__L_XmlHttp = new XMLHttpRequest();}catch(e){__L_XmlHttp = false;}}
if(!__L_XmlHttp && window.createRequest) {try {__L_XmlHttp = window.createRequest();}catch(e) {__L_XmlHttp = false;}}
var __L_C0071 = "Sign In";
var __L_C1013 = "Please enter your email address.";
var __L_UR004 = "Forgot your password?";
var __L_UR009 = "Incorrect email or password. The passwords are case sensitive. Please check your CAPS lock key..";
var __L_UR013 = "Enter your email address";
var __L_UR014 = "Enter your password";
var __L_UR015 = "Please enter your password.";
var __L_UR016 = "Remember me on this computer";
var __L_UR073 = "Sign Up Free Now";
var __L_CallBack = null;
function $Login$(callBack) 
{
    if(!__L_XmlHttp) return;
    showProgressBar(false,true);
    WebServices.User.Public.GetLoginRes($onsuccGetLoginRes$);
    __L_CallBack = callBack;
    //$onsuccGetLoginRes$();
}
function $onsuccGetLoginRes$(result)
{
    showProgressBar(false,true);
    __L_C0071 = result[0];
    __L_C1013 = result[1];
    __L_UR004 = result[2];
    __L_UR009 = result[3];
    __L_UR013 = result[4];
    __L_UR014 = result[5];
    __L_UR015 = result[6];
    __L_UR016 = result[7];
    __L_UR073 = result[8];
    $("$divIput$").style.display = "none";
    var Text = "<div class='Popup_content'><h3>"+__L_C0071+"</h3><p><strong>"+__L_UR013+"</strong><br /><input type='text' id='__L_Username' class='Input_Big' maxlength='100' onblur='__L_suname()'onkeydown='$Enter$(event,\"__L_UserPassword\")' /><span id='__L_valPas' style='color: Red; display: none;' class='red10'><br />"+__L_C1013+"</span><br /></p><p><strong>"+__L_UR014+"</strong><br /><input id='__L_UserPassword' class='Input_Big' maxlength='20' onblur='__L_supaw()' type='password' onkeydown='$Enter$(event,\"__L_LoginButton\")'/><span id='__L_valPas1' style='color: Red; display: none;' class='red10'><br />"+__L_UR015+"</span></p><span id='__L_lab' ForeColor='red' style='display:none'></span><p><input type='checkbox' id='__L_CheckBox1' checked='checked' />"+__L_UR016+"</p><p><input type='button' id='__L_LoginButton' class='button' value='"+__L_C0071+"'/></p><p><a href='#' onclick='__L_fpaw()'>"+__L_UR004+"</a></p><p><a href='#' onclick='__L_signup()'>"+__L_UR073+"</a></p></div>";
    __L_Show(Text);
    $("__L_Username").focus();
}

function __L_Show(text)
{
    $ShowMessageBox$(__L_C0071,text,null,null,300);
    $AddHandler$("click",$("__L_LoginButton"),__L_Login);
}

function __L_Login()
{
    if($("__L_Username").value=="")
    {
        $("__L_valPas").style.display="";return;
    }
    if($("__L_UserPassword").value=="")
    {
        $("__L_valPas1").style.display="";return;
    }
    __L_XmlHttp.open("POST", "/user/JSLogin.htm", true);
    __L_XmlHttp.setRequestHeader("content-type", "application/x-www-form-urlencoded");
    __L_XmlHttp.onreadystatechange = function() 
    {
        if(__L_XmlHttp.readyState == 4 || __L_XmlHttp.readyState == "complete") 
        {
            if(__L_XmlHttp.status == 200 || __L_XmlHttp.status == 0) 
            {
                if(__L_XmlHttp.responseText.substr(0,1)=="0")
                {
                    __P_M = __L_XmlHttp.responseText.substr(1,10);
                    $(__unLogin__).innerHTML = __L_XmlHttp.responseText.substr(11);
                    $EndMessageBox$();
                    if(__L_CallBack&& typeof(__L_CallBack)==="function" ) __L_CallBack();
                }
                else
                {
                    $("__L_lab").style.display="block";$("__L_lab").innerHTML = __L_UR009;
                }
            }
        }
    }
    __L_XmlHttp.send("U=" + $("__L_Username").value+"&P=" + $("__L_UserPassword").value+"&C="+($("__L_CheckBox1").checked?"1":"0"));
}

function __L_suname()
{
    if($("__L_valPas").style.display==""&&$("__L_Username").value!="")
    {
        $("__L_valPas").style.display="none"
    }
}
function __L_supaw()
{
    if($("__L_valPas1").style.display==""&&$("__L_UserPassword").value!="")
    {
        $("__L_valPas1").style.display="none"
    }
}
function __L_fpaw()
{
    window.open("/user/getmypassword.htm");
}
function __L_signup()
{
    window.open("/user/register.htm");
}